package com.yueyang.sojourn.server.service.sojourn.order;

import com.yueyang.sojourn.server.model.po.SojournOrderMerch;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 订单商品快照服务
 * @author andy.yang
 * @version v1
 * @summary
 * @Copyright (c) 2019, yueyang Group All Rights Reserved.
 * @since 2020/3/17
 */
@Service
public class SojournOrderMerchService {
    @Resource
    SojournOrderMerchMapper sojournOrderMerchMapper;

    /**
     * 创建订单商品快照
     * @param merch
     * @return
     */
    public Long add(SojournOrderMerch merch){
        return sojournOrderMerchMapper.insert(merch);
    }

    /**
     * @param userId      所属用户id
     * @return com.github.pagehelper.PageInfo<com.yueyang.sojourn.server.model.vo.SojournMerchVo>
     * @author Andy.yang
     * @summary 订单分页查询
     * @version v1
     * @since 2020-02-19
     */
    public List<SojournOrderMerch> findList(Long userId) {
        return sojournOrderMerchMapper.findBy(userId);
    }

    /**
     * @param orderMerchId      订单订单商品快照id
     * @return
     * @author Andy.yang
     * @summary 订单分页查询
     * @version v1
     * @since 2020-02-19
     */
    public SojournOrderMerch findById(Long orderMerchId) {
        return sojournOrderMerchMapper.selectByPrimaryKey(orderMerchId);
    }
}
